<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2014 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: Dean <zxxjjforever@163.com>
// +----------------------------------------------------------------------
namespace Portal\Controller;
use Common\Controller\HomeBaseController; 
/**
 * 医生阵容
 */
class DocController extends HomeBaseController {
	
    //医生列表面
	public function plist() {
        $this->assign('select','9');
        $doc_list=D("Doc")->order("csort desc")->select();
        $this->assign("doc_list",$doc_list);
    	$this->display();
    }   
    //医生详情
    public function detail(){
         $this->assign('select','9');
         $id=I("id");
         if(IS_POST){
            $doctel=D("Common/DocTel");
            if($doctel->create()){
                $addid=$doctel->add();
                if($addid){
                    $this->success("添加成功");
                }else{
                    $this->error("添加失败");
                }
            }else{
                $this->error($doctel->getError());
            }
         
         }
         D("Doc")->where(array("id"=>$id))->setInc("click_num",1);
         $doc_info=D("Doc")->where(array("id"=>$id))->find();
         $this->assign("doc_info",$doc_info);
         
         //上一篇
         $topmap=array();
         $topmap['id']=array("LT",$id);
         $top_info=D("Doc")->where($topmap)->order("csort desc,id desc")->find();
         $this->assign("top_info",$top_info);
    
         //下一篇
          $nextmap=array();
          $nextmap['id']=array("GT",$id);
          $next_info=D("Doc")->where($nextmap)->order("csort desc,id asc")->find();
          $this->assign("next_info",$next_info);
         //浏览列表
         $map=array();
         $map["id"] = array("NOTIN",$id);
         $doc_common_list=D("Doc")->where($map)->order("click_num")->limit(8)->select();
         $this->assign("doc_common_list",$doc_common_list);
        $this->display();
    }
    
}



